import { Connection } from "./Server"

export class Response {
    private obj: {
        [key: string]: any
    }
    private con: Connection
    constructor(data: string, con: Connection) {
        this.obj = JSON.parse(data)
        console.log(data, 'this.obj');

        this.con = con
    }

    public get(key: string) {
        return this.obj[key]
    }

    public sendStr(data: string) {
        this.con.send(JSON.stringify({
            data,
            handleKey: this.obj.handleKey
        }))
    }
}